<!doctype html>
<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
    <%@ include file="/WEB-INF/views-jsp/include/taglib/taglib.jsp" %>
    <%@ include file="/WEB-INF/views-jsp/include/meta/meta.jsp" %>
    <%@ include file="/WEB-INF/views-jsp/include/link/link.jsp" %>
    <%@ include file="/WEB-INF/views-jsp/include/script/script.jsp" %>
    <script type="text/javascript" src="${path}/html/js/js-jsp/workflow/task/myTask.js?v=<%out.print(Math.random());%>"></script>
    <script type="text/javascript" src="${path}/html/js/js-jsp/workflow/task/myTaskForm.js?v=<%out.print(Math.random());%>"></script>
    <style type="text/css">
        table{ border:0px solid #CCCCCC; }
        table td{text-align: center}
        table tr{ height:30px; line-height: 30px; }
        table textarea{width:99%; height:135px;  float:left;  border: 1px solid #CCCCCC}
        .radio{width:55px; height:30px; line-height: 30px;  float:left}
        .left_Panel{ width: 95%; margin: 0 auto; height: auto; margin-top: 5px; font-size: 10px;}
        .left_Panel .span{ font-size: 10px; padding-left: 5px;  line-height: 25px; }
        .panel-header .panel-title span {  margin: 0 0px;  }
    </style>
</head>
<body class="easyui-layout">
<!--菜单页面-->
<div data-options='region:"west", title:"&nbsp;", split:true, border:false' style="width:16%; overflow:scroll">
    <c:forEach items="${historicActivityInstances}" var="historicActivityInstance">
        <c:if test="${'startEvent' == historicActivityInstance.activityType}">
            <div class="left_Panel">
                <div class="easyui-panel" title="<span style='font-size: 12px; font-weight: bold; color: #0E2D5F'>【${historicActivityInstance.activityName}】</span>" style="width:100%; height:100%" data-options="iconCls:'icon-edit'">
                    <p class="span">开始时间：<fmt:formatDate value="${historicActivityInstance.startTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                    <p class="span">办理用户：系统</p>
                    <p class="span">流程状态：开始</p>
                    <p class="span">结束时间：<fmt:formatDate value="${historicActivityInstance.endTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                </div>
            </div>
        </c:if>
        <c:if test="${'userTask' == historicActivityInstance.activityType}">
            <c:set var="thisActivityName" value="${historicActivityInstance.activityName}" />
            <div class="left_Panel">
                <div class="easyui-panel" title="<span style='font-size: 12px; font-weight: bold; color: #0E2D5F'>【${historicActivityInstance.activityName}】</span>" style="width:100%; height:100%" data-options="iconCls:'icon-edit'">
                    <p class="span">开始时间：<fmt:formatDate value="${historicActivityInstance.startTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                    <p class="span">办理用户：${emNameMap[historicActivityInstance.assignee]}</p>
                    <c:forEach items="${comments}" var="comment">
                        <c:choose>
                            <c:when test="${ historicActivityInstance.processInstanceId == comment.processInstanceId and  historicActivityInstance.taskId == comment.taskId }">
                                <p class="span">是否同意：${fn:substring(comment.message, 0, fn:indexOf(comment.message, "▲"))}</p>
                                <p class="span">审核意见：${fn:substring(comment.message, fn:indexOf(comment.message, "▲") + 1, fn:length(comment.message))}</p>
                            </c:when>
                        </c:choose>
                    </c:forEach>
                    <p class="span">结束时间：<fmt:formatDate value="${historicActivityInstance.endTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                </div>
            </div>
        </c:if>
        <c:if test="${'endEvent' == historicActivityInstance.activityType}">
            <div class="left_Panel">
                <div class="easyui-panel" title="<span style='font-size: 12px; font-weight: bold; color: #0E2D5F'>【${historicActivityInstance.activityName}】</span>" style="width:100%; height:100%" data-options="iconCls:'icon-edit'">
                    <p class="span">开始时间：<fmt:formatDate value="${historicActivityInstance.startTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                    <p class="span">办理用户：系统</p>
                    <p class="span">流程状态：结束</p>
                    <p class="span">结束时间：<fmt:formatDate value="${historicActivityInstance.endTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                </div>
            </div>
        </c:if>
    </c:forEach>

</div>
<!--内容页面-->
<div data-options="region:'center', split:false" style="overflow: scroll">
    <table width="98%" style="height: 70px; border: none; text-align: center; ">
        <tr>
            <td style="font-size: 26px; font-weight: bold">采购申请单</td>
        </tr>
    </table>

    <!--采购申请栏目信息-->
    <table id="easyuiDgApply" style="width:98%; overflow: hidden" class="easyui-datagrid" title="<span style='text-align: center; font-size: 14px; font-weight: bold; color: #0E2D5F'>申请栏【填写】</span>" data-options="singleSelect:true,  border: 0, fitColumns: true">
        <thead>
            <tr>
                <th data-options="field:'option_apply_01',width: '16%', fixed: true">采购单号：</th>
                <th data-options="field:'option_apply_02',width: '16%', fixed: true">${purchaseApply.purCode}</th>
                <th data-options="field:'option_apply_03',width: '16%', fixed: true">申请用户：</th>
                <th data-options="field:'option_apply_04',width: '16%', fixed: true">${purchaseApply.purPerson}</th>
                <th data-options="field:'option_apply_05',width: '16%', fixed: true">申请时间：</th>
                <th data-options="field:'option_apply_06',width: '15%'"><fmt:formatDate value="${purchaseApply.purDate}" pattern="yyyy-MM-dd HH:mm:ss" /></th>
            </tr>
        </thead>
    </table>

    <!--采购清单信息-->
    <table id="easyuiDgApplyDetail" style="width:98%" class="easyui-datagrid" title="采购清单信息" data-options="singleSelect:true,  border: 0, fitColumns: true">
        <thead>
            <tr>
                <th data-options="field:'option_applyDetail_01',width: '12%', fixed: true">物料名称</th>
                <th data-options="field:'option_applyDetail_02',width: '12%', fixed: true">材料品牌</th>
                <th data-options="field:'option_applyDetail_03',width: '12%', fixed: true">规格型号</th>
                <th data-options="field:'option_applyDetail_04',width: '10%', fixed: true">技术参数</th>
                <th data-options="field:'option_applyDetail_05',width: '5.5%',  fixed: true">计量单位</th>
                <th data-options="field:'option_applyDetail_06',width: '7%', fixed: true">合同单价</th>
                <th data-options="field:'option_applyDetail_07',width: '8%', fixed: true">采购单价</th>
                <th data-options="field:'option_applyDetail_08',width: '8%',  fixed: true">合同剩余量</th>
                <th data-options="field:'option_applyDetail_09',width: '8%',  fixed: true">采购数量</th>
                <th data-options="field:'option_applyDetail_10',width: '8%',  fixed: true">采购合计</th>
            </tr>
        </thead>
        <tbody>
            <c:set var="sumPurdTotalPrice" value="0" />
            <c:set var="sumPurdNum" value="0" />
            <c:forEach items="${purchaseDetails}" var="purchaseDetail">
                <tr>
                    <td>${purchaseDetail.material.materialName}</td>
                    <td>${purchaseDetail.material.brand}</td>
                    <td>${purchaseDetail.material.standardType}</td>
                    <td>${purchaseDetail.material.technicalParameter}</td>
                    <td>${purchaseDetail.material.meteringUnit}</td>
                    <td><fmt:formatNumber value="${purchaseDetail.contract.unitContractPrice == null?0:purchaseDetail.contract.unitContractPrice}" pattern="#,#00.0#"/></td>
                    <td><fmt:formatNumber value="${purchaseDetail.material.unitPrice}" pattern="#,#00.0#"/></td>
                    <td>${purchaseDetail.contract.leftCount}</td>
                    <td>${purchaseDetail.purdNum}</td>
                    <td><fmt:formatNumber value="${purchaseDetail.purdTotalPrice}" pattern="#,#00.0#"/></td>
                </tr>
                <c:set var="sumPurdTotalPrice" value="${sumPurdTotalPrice  + purchaseDetail.purdTotalPrice}" />
                <c:set var="sumPurdNum" value="${sumPurdNum  + purchaseDetail.purdNum}" />
            </c:forEach>
            <c:if test="${empty purchaseDetails}" >
                <tr>
                    <td colspan="10" style="text-align: center;">暂无采购清单信息！</td>
                </tr>
            </c:if>
        </tbody>
    </table>

    <!--采购统计信息-->
    <table id="easyuiDgSum"  style="width:98%" class="easyui-datagrid" data-options="singleSelect:true,  border: 0, fitColumns: true">
        <thead>
        <tr>
            <th data-options="field:'option_sum_01',width: '16%', fixed: true"><span style="font-weight: bold">采购总数量：</span></th>
            <th data-options="field:'option_sum_02',width: '82%', align: 'left'">${sumPurdNum}</th>
        </tr>
        <tr>
            <th data-options="field:'option_sum_01',width: '16%', fixed: true"><span style="font-weight: bold">采购总金额：</span></th>
            <th data-options="field:'option_sum_02',width: '82%', align: 'left'"><fmt:formatNumber value="${sumPurdTotalPrice}" pattern="#,#00.0#"/> 元</th>
        </tr>
        </thead>
    </table>

    <!--采购附件信息-->
    <table id="easyuiDgFile" style="width:98%" class="easyui-datagrid" title="采购附件信息" data-options="singleSelect:true, border: 0, fitColumns: true">
        <thead>
            <tr>
                <th data-options="field:'option_file_01',width: '30%', fixed: true">附件名称</th>
                <th data-options="field:'option_file_02',width: '68%', align: 'left'">操作</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${commonFiles}" var="commonFile">
                <tr>
                    <td>${commonFile.name}</td>
                    <td>
                        <a id="downFile" class="easyui-linkbutton c1" onclick="commonFile_down('${commonFile.fileId}')" style="width:60px; height: 28px" >下载</a>&nbsp;&nbsp;
                        <a id="delFile" class="easyui-linkbutton c1" onclick="commonFile_del('${commonFile.fileId}', '${commonFile.name}')" disabled="disabled" style="width:60px; height: 28px">删除</a>
                   </td>
                </tr>
            </c:forEach>
            <c:if test="${empty commonFiles}" >
                <tr>
                    <td colspan="2" style="text-align: center;">暂无采购附件信息!</td>
                </tr>
            </c:if>
        </tbody>
    </table>

    <!--工作流程【审批】-->
    <form id="task_form" name="task_form" class="form" method="post" action="#">
        <table id="dgAudit"  style="width:98%; text-align: center; border: 1px #ccc solid">
            <tr style="height: 40px; border-left: none; border-top: none; border-bottom: 1px #ccc solid; background: #f8f8f8">
                <td colspan="2">
                    <span style='text-align: center; font-size: 14px; font-weight: bold; color: #0E2D5F'>${thisActivityName}【审批】</span>
                </td>
            </tr>
            <tr style="height: 40px; border-left: none; border-top: none; border-bottom: 1px #ccc solid">
                <input type="hidden" id="thisActivityName" name="thisActivityName" value="${thisActivityName}" />
                <input name="taskId" type="hidden" value="${task.id}" />
                <input name="purId" type="hidden" value="${purchaseApply.purId}" />
                <input id="assignee" name="assignee" type="hidden" value="" />
                <c:if test="${'项目部项目经理' == thisActivityName}">
                    <input name="variableName" type="hidden" value="departmentMgr" />
                </c:if>
                <c:if test="${'项目部副经理' == thisActivityName}">
                    <input name="variableName" type="hidden" value="technologyMgr" />
                </c:if>
                <c:if test="${'项目部经理' == thisActivityName}">
                    <input name="variableName" type="hidden" value="purshPerson" />
                </c:if>
                <c:if test="${'采购部副经理' == thisActivityName}">
                    <input name="variableName" type="hidden" value="purshMgr" />
                </c:if>
                <c:if test="${'采购部分管领导' == thisActivityName}">
                    <input name="variableName" type="hidden" value="superMgr" />
                </c:if>
                <th style="width: 16%; font-weight: normal; border-left: none">是否同意：</th>
                <th style="width: 82%; font-weight: normal; border-left: 1px #ccc solid">
                    <div class="radio">
                         <input type="radio" name="radioKey" value="1" checked="checked"  /> 同意
                    </div>
                    <div class="radio">
                        <input type="radio" name="radioKey"  value="2" /> 不同意
                    </div>
                </th>
            </tr>
            <tr style="height: 130px; border-left: none;">
                <td style="width: 16%; border-left: none">审核意见：</td>
                <td style="width: 82%; border-left: 1px #ccc solid">
                    <textarea name="message" id="message" style="width:98.5%; height:120px; margin: 5px"></textarea>
                </td>
            </tr>
        </table>
    </form>

        <!--操作按钮-->
        <table style="height: 80px; width: 98%">
            <tr>
                <td>
                    <div class="formbody">
                        <div style="width: 100%">
                            <a id="commitBtn" class="easyui-linkbutton c1" style="width:100px; height: 35px;  margin: 0 auto">提交</a> &nbsp;&nbsp;
                            <a id="closeBtn" class="easyui-linkbutton c1" style="width:100px; height: 35px; margin: 0 auto">关闭</a>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <div id="selUserWindow" />
</div>
<script type="text/javascript">
    window.parent.disLoading('taskWindow');
</script>
</body>
</html>

